home *** CD-ROM | disk | FTP | other *** search
- COMBINE.COM is used to insert strings from the command line into the standard
- output using lines from the standard input device.
-
- The strings are attached to the input lines as prefixes or suffixes as described
- in the following discussion.
-
- When I designed the program, its primary purpose was to create commands for
- batch files using file names supplied from standard input along with commands
- and parameters from the command line. But at least one other use has been
- made of the program: to insert tabs before each line of a file sent to a printer
- to create a left margin for printing.
-
- Study the syntax below carefully. Remember that even the spaces are very
- important.
-
- Syntax: COMBINE [-"str1"][+"str2"][ [+"str3"][-"str4"]] ...
-
- - for prefix string
- + for suffix string
-
- Prefix and suffix strings with no spaces between them
- are treated as matched sets. One or more spaces
- separate sets. Each set is used to construct a line
- of output for each input line. If there are two sets,
- there will be two lines in the output for each input
- line (one for each set).
-
- It does not matter which string in a set is entered first. If you enter two or
- more of the same type of string for a set, the last one is used and the
- previous ones are ignored and no error is indicated.
-
- Though the prefix and suffix strings are enclosed in quotes ("), you may
- include quotes in those strings by entering two for each one you want.
-
- To be sure that you understand how COMBINE works, try a few of the following
- examples.
-
- COMBINE -"A"
- COMBINE +"B"
- COMBINE -"A"+"B"
- COMBINE -"A" +"B"
- COMBINE -"A"+"B" -"C"+"D"
- COMBINE -""""+""""
-
- The following is a rather complex example of a batch file called @DELALQ.BAT
- that I wrote using this program along with a few others to delete all matching
- files from a disk after asking you for confirmation. The other programs are
- GETKEY which sets the DOS ERRORLEVEL indicator according to the value of the
- key you press, WHEREIS which is my own adaptation of that program, and WC
- which was modified substantially from one which came with CHASM (the cheap
- assembler package).
-
- @DELALQ.BAT
-
- echo off
- %VDISK%WHEREIS %1/F/N >%VDISK%JUNK
- IF NOT ERRORLEVEL 1 GOTO OK
- ECHO No files to delete
- GOTO ERROR
- :OK
- ECHO echo off >%VDISK%JUNK.BAT
- %VDISK%WC/L <%VDISK%JUNK
- %VDISK%COMBINE -"%VDISK%GETKEY {YN} "+" ? " -"IF ERRORLEVEL 89 DEL " <%VDISK%JUNK >>%VDISK%JUNK.BAT
- %COMSPEC% /C %VDISK%JUNK
- :ERROR
- DEL %VDISK%JUNK.*
-
- Here are two more examples which use another program: FILES. That program lists
-
- the names of files and (optionally) other information about them (if needed).
-
- @SHOWALL.BAT
-
- echo off
- %VDISK%WHEREIS %1/F >%VDISK%JUNK
- IF NOT ERRORLEVEL 1 GOTO OK
- ECHO No files to show
- GOTO ERROR
- :OK
- %VDISK%WC/L <%VDISK%JUNK
- %VDISK%GETKEY {YN} OK?
- IF NOT ERRORLEVEL 89 GOTO ERROR
- ECHO echo off >%VDISK%JUNK.BAT
- %VDISK%COMBINE -"FILES "+"/B/F%2" <%VDISK%JUNK >>%VDISK%JUNK.BAT
- %COMSPEC% /C %VDISK%JUNK
- :ERROR
- DEL %VDISK%JUNK.*
-
- @SHOWALQ.BAT
-
- echo off
- %VDISK%WHEREIS %1/F >%VDISK%JUNK
- IF NOT ERRORLEVEL 1 GOTO OK
- ECHO No files to show
- GOTO ERROR
- :OK
- ECHO echo off >%VDISK%JUNK.BAT
- %VDISK%WC/L <%VDISK%JUNK
- %VDISK%COMBINE -"%VDISK%GETKEY {YN} "+" ? " -"IF ERRORLEVEL 89 FILES "+"/B/F/P%2" <%VDISK%JUNK >>%VDISK%JUNK.BAT
- %COMSPEC% /C %VDISK%JUNK
- :ERROR
- DEL %VDISK%JUNK.*
- ? " -"IF ERRORLEVEL 89 FILES "+"/B/F/P%2" <%VDISK%JUNK >>%VDISK%JUNK.BAT
- %COMS